# 计科1915班 0306224505 屠玉宝

import random


# 将球平均分配到分配到袋子中
def fenpei(lst, daizi):
    # 随机打乱列表顺序
    random.shuffle(lst)
    # print(lst)
    for num in lst:
        if num % 3 == 0:
            daizi[0].append(num)
        elif num % 3 == 1:
            daizi[1].append(num)
        else:
            daizi[2].append(num)
    print(daizi)


# 将球随机分配到袋子中
def fenpei1(lst, daizi):
    for i in lst:
        daizi[random.randint(0, 2)].append(i)
    print(daizi)


if __name__ == '__main__':
    # 创建一个包含1到9的数字列表
    nums = list(range(1, 10))
    # 初始化三个袋子
    daizi = [[], [], []]
    # fenpei(nums, daizi)
    fenpei1(nums, daizi)
